<!-- BEGIN PAGE HEADER-->
<?php $this->load->view('partials/breadcrumb.tpl', Array('_BTN_GROUP'=>Array('name'=>'返回', 'url'=>site_url($thisModule.$thisController))))?>
<!-- END PAGE HEADER-->
<script type="text/javascript">
function toggleStatusConfirm(url){
	if(!confirm("确定要改变用户状态吗？")){
		return false;
	}
	window.location.href = url;
	return true;
}

function requestUserAmount(user_id){
	$.post("<?=site_url('/handle/useramount/postRequestAmountInGame/')?>",{user_id},function(ret){
		var retObj = $.parseJSON(ret);
		if(retObj.code < 0){
			alert(retObj.message);
			return;
		}
		$('#amount').html(' '+retObj.amount+" 元");
	});
}
</script>
<!-- BEGIN PAGE CONTENT-->
<div class="row">
	<div class="col-xs-12 ">
	<!-- BEGIN SAMPLE FORM PORTLET-->
		<div class="portlet">
			<div class="tabbable">
				<div class="tab-content">
					<div class="tab-pane active" id="tab_1">
						<div class="row">
							<!-- 用户个人账号信息和银行卡信息开始 -->
							<div class="col-md-5 col-sm-12">
								<div class="portlet box green">
									<div class="portlet-title">
										<div class="caption">
											<i class="fa fa-cogs"></i>用户个人账号信息
										</div>
									</div>
									<div class="portlet-body" style="line-height:25px;">
										<div class="row static-info">
											<div class="col-xs-5 name">用户编号:</div>
											<div class="col-xs-7 value">
												<span><?=htmlspecialchars($user->id)?></span>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">用户账号:</div>
											<div class="col-xs-7 value">
												<span><?=htmlspecialchars($user->account)?></span>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">用户账号状态:</div>
											<div class="col-xs-7 value">
												<div class="col-xs-4" style="padding: 6px 12px;">
                    								<?php if($user->status == 0){ ?>
                    									禁用&nbsp;&nbsp;
                    									<button type="button" class="btn blue btn-sm" onclick="javascript:void(toggleStatusConfirm('/usermanage/user/toggleStatus/<?php echo $user->id ?>/<?php echo $user->update_time ?>'))">启用</button> 
                    								<?php }else{ ?>
                    									启用&nbsp;&nbsp;
                    									<button type="button" class="btn blue btn-sm" onclick="javascript:void(toggleStatusConfirm('/usermanage/user/toggleStatus/<?php echo $user->id ?>/<?php echo $user->update_time ?>'))" >禁用</button>		
                    								<?php } ?>
                    							</div>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">直接上级账号:</div>
											<div class="col-xs-7 value">
												<?php if($p_user):?>
												<span><a href="<?=site_url($thisModule.$thisController.'/edit/'.$p_user->id)?>"><?=$p_user->account?></a></span>
												<?php else:?>
												<span style="color:red;">无直接上级账号</span>
												<?php endif;?>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">修改密码:</div>
											<div class="col-xs-7 value">
												<a style="border-bottom: dashed 1px #0088cc;color: #5b9bd1;text-decoration: none;" href="javascript:ioss_url_modal('<?=site_url($thisModule. $thisController. '/changePass/'.$user->id.'/'.$user->update_time)?>');"  data-original-title=""> 
									修改 </a>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">用户注册时间:</div>
											<div class="col-xs-7 value">
												<span><?=date('Y-m-d H:i:s',$user->create_time)?></span>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">用户注册时IP:</div>
											<div class="col-xs-7 value">
												<span><?=htmlspecialchars($user->reg_ip)?></span>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">用户上次登录IP:</div>
											<div class="col-xs-7 value">
												<span><?=htmlspecialchars($user->login_ip)?></span>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">用户上次登录时间:</div>
											<div class="col-xs-7 value">
												<span><?=date('Y-m-d H:i:s', $user->login_time)?> </span>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">剩余返利数量:</div>
											<div class="col-xs-7 value"><?=$user->commissions.' 元'?></div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">返利累计金额:</div>
											<div class="col-xs-7 value"><?=$user->commissions_total.' 元'?></div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">游戏平台内余额:</div>
											<div class="col-xs-7 value">
												<a href="javascript:requestUserAmount('<?=$user->id?>');">请求</a> <span id="amount" style="color:green;"></span>
											</div>
										</div>
										<div class="row static-info">
											<div class="col-xs-5 name">用户关联自有通道编号:</div>
											<div class="col-xs-7 value"><?=$user->set_bank_code?></div>
										</div>
										
										<?php if($bankInfo){ ?>
										<div class="row static-info">
											<div class="col-xs-5 name">用户通道:</div>
											<div class="col-xs-7 value"><?=$bankInfo->card_name?>&nbsp;&nbsp;<a style="border-bottom: dashed 1px #0088cc;color: #5b9bd1;text-decoration: none;" href="javascript:ioss_url_modal('<?=site_url($thisModule. $thisController. '/deleteBank/'.$user->id)?>');" data-original-title="">详细</a></div>
										</div>
                						<?php } ?>
									</div>
								</div>
							</div>
							<!-- 用户个人账号信息和银行卡信息结束 -->
							<!-- 该用户下级账号列表 -->
							<div class="col-md-7 col-sm-12">
								<div class="portlet green box">
									<div class="portlet-title">
										<div class="caption"><i class="fa fa-cogs"></i>直接下级列表</div>
									</div>
									<table class="table table-hover table-bordered table-striped" style="background: white;">
										<thead>
											<th>编号</th>
											<th>账号</th>
											<th>注册IP</th>
											<th>上次登录IP</th>
											<th>上次登录时间</th>
										</thead>
										<tbody>
											<?php if(count($childrenUserList)>0):?>
											<?php foreach ($childrenUserList as $v):?>
											<tr>
    											<td><?=$v->id?></td>
    											<td><a href="<?=site_url($thisModule.$thisController.'/edit/'.$v->id)?>"><?=$v->account?></a></td>
    											<td><?=$v->reg_ip?></td>
    											<td><?=$v->login_ip?></td>
    											<td><?=date('Y-m-d H:i:s',$v->login_time)?></td>
											</tr>
											<?php endforeach;?>
											<?php else:?>
											<tr>
												<td colspan="5" style="color:red;text-align:center;">无直接下级用户</td>
											</tr>
											<?php endif;?>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- END SAMPLE FORM PORTLET-->
	
	
	
	
		<!-- BEGIN SAMPLE FORM PORTLET-->
		<div class="portlet box green ">
			<div class="portlet-title">
				<div class="caption"><i class="fa fa-cogs"></i>用户历史记录相关信息</div>
			</div>
			<!-- 用户游戏记录开始 -->
						<div class="portlet-body">
            				<div class="row">
            					<div class="col-md-12">
            						<div class="portlet-title">
    									<div class="caption">
    										<i class=""></i><span style="color:purple;font-size:16px;">该用户曾经所有操作记录</span>
    									</div>
    								</div>
            						<div class="table-scrollable">
            							<table class="table table-hover table-bordered table-striped">
            								<thead>
            								<tr>
            									<th width="10%">记录编号</th>				
            									<th width="10%">记录单号</th>
            									<th width="10%">记录数量</th>
            									<th width="10%">记录时间</th>
            								</tr>
            								</thead>
            								<tbody>
            								<?php if(count($list)):?>
            								<?php  foreach ($list as $node){	?>
            									<tr>
            										<td><?=htmlspecialchars($node->id)?></td>
            										<td><?=htmlspecialchars($node->bill_no)?></td>
            										<td><?=htmlspecialchars($node->net_amount)?></td>
            										<td><?=date('Y-m-d H:i:s',$node->bet_time)?></td>
            									</tr>
            								<?php }?>
            								<?php else:?>
            									<tr>
            										<td colspan="4" align="center" style="color:red;">该用户操作记录为空</td>
            									</tr>
            								<?php endif;?>
            								</tbody>
            							</table>
            						</div>
            					</div>
            				</div>
            				<div class="row">
            					<div class="col-md-12 text-right">
            						<?=$pagination?>
            					</div>
            				</div>
            			</div>
						<!-- 用户游戏记录结束 -->
						
						<!-- 该用户曾经充值记录开始 -->
						<div class="portlet-body">
            				<div class="row">
    							<div class="col-md-12 col-sm-12">
    								<div class="portlet-title">
    									<div class="caption">
    										<i class=""></i><span style="color:green;font-size:16px;">该用户曾经所有订单记录</span>
    									</div>
    								</div>
    								<div class="table-scrollable">
            							<table class="table table-hover table-bordered table-striped">
            								<thead>
            								<tr>
            									<th width="15%">订单号</th>				
            									<th width="10%">数量</th>
            									<th width="15%">通道</th>
            									<th width="15%">创建时间</th>
            									<th width="10%">通道状态</th>
            									<th width="10%">平台状态</th>
            								</tr>
            								</thead>
            								<tbody>
            								<?php if(count($orders)):?>
            								<?php  foreach ($orders as $node){	?>
            									<tr>
            										<td>
            										<span><?=htmlspecialchars($node->no)?></span>
            										</td>
            										<td><?=htmlspecialchars($node->amount)?></td>
            										<td><?=htmlspecialchars($node->pay_channel)?></td>
            										<td><?=date('Y-m-d H:i:s',$node->create_time)?></td>
            										<td><span style="cursor:text" class="<?=element($node->pay_status, $this->pay_status_css, '')?>"><?=IOSS_Order::getPayState($node->pay_status)?></span></td>
            										<td><span style="cursor:text" class="<?=element($node->transfer_status, $this->transfer_status_css, '')?>"><?=IOSS_Order::getRechargeState($node->transfer_status)?></span></td>
            									</tr>
            								<?php }?>
            								<?php else:?>
            									<tr>
            										<td colspan="6" align="center" style="color:red;">该用户订单记录为空</td>
            									</tr>
            								<?php endif;?>
            								</tbody>
            							</table>
            						</div>
    							</div>
    						</div>
            			</div>
						
						<!-- 该用户曾经充值记录结束 -->
						
						<!-- 该用户曾经提款记录开始 -->
						<div class="portlet-body">
    						<div class="row">
    							<div class="col-md-12 col-sm-12">
    								<div class="portlet-title">
    									<div class="caption">
    										<i class=""></i><span style="color:red;font-size:16px;">该用户曾经所有红利记录</span>
    									</div>
    								</div>
    								<div class="table-scrollable">
            							<table class="table table-hover table-bordered table-striped">
            								<thead>
                								<tr>
                									<th width="10%">红利单号</th>				
                									<th width="10%">数量</th>
                									<th width="15%">申请时间</th>
                									<th width="10%">流水号</th>
                									<th width="10%">平台状态</th>
                									<th width="10%">红利审核状态</th>
                								</tr>
                								</thead>
                								<tbody>
                								<?php if(count($withdraws)):?>
                								<?php  foreach ($withdraws as $node){	?>
                									<tr>
                										<td>
                										<span><?=htmlspecialchars($node->no)?></span>
                										</td>
                										<td><?=htmlspecialchars($node->amount)?></td>
                										<td><?=date('Y-m-d H:i:s',$node->create_time)?></td>
                										<td><?=htmlspecialchars($node->withdraw_transaction)?></td>
                										<td><span style="cursor:text" class="<?=element($node->transfer_status, $this->transfer_status_css, '')?>"><?=IOSS_Withdraw::getTransferState($node->transfer_status)?></span></td>
                										<td><span style="cursor:text" class="<?=element($node->withdraw_status, $this->pay_status_css, '')?>"><?=IOSS_Withdraw::getWithdrawState($node->withdraw_status)?></span></td>
                									</tr>
                								<?php }?>
                								<?php else:?>
                									<tr>
                										<td colspan="6" align="center" style="color:red;">该用户红利记录为空</td>
                									</tr>
                								<?php endif;?>
                								</tbody>
            							</table>
            						</div>
    							</div>
    						</div>
    					</div>
						<!-- 该用户曾经提款记录结束 -->
		</div>
		<!-- END SAMPLE FORM PORTLET-->
		<!-- BEGIN SAMPLE FORM PORTLET-->
	</div>
</div>
<!-- END PAGE CONTENT-->
<link href="<?=image_url('/static/assets/global/plugins/jstree/dist/themes/default/style.min.css')?>" rel="stylesheet" type="text/css"/>

